import Vue from 'vue'
import Vuex from 'vuex'

import api from "@/config/api.js";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count: 0,
    userinfo:""
  },
  mutations: {
    setUserInfo(state,user){
       state.userinfo = user;
    }
  },
  actions: {
    async getUserById({commit},id){
      var user = await api.getUserById({id});
      commit("setUserInfo",user);
    }
  },
  modules: {

  }
})
